package com.supkong.singleton;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: DELL
 * @date: 2021/9/27 20:24
 * @description:
 */
public class Test {
    static  int a = 0;
    static  volatile boolean flag = false;
    static  int i = 4;
    static void reader (){
        a = 1;
        flag = true;
    }
    static void  writer(){
        if (flag){
            i=a;
        }
        System.out.println(i);
    }

    public static void main(String[] args) {
//        Thread t1 =  new Thread(()->{
//            reader();
//        });
//        Thread t2 =  new Thread(()->{
//            writer();
//        });
//        t1.start();;
//        t2.start();
        Good good = new Good("123",1);
        List<Good> list = new ArrayList<>();
        list.add(good);
        good.setName("456");
        list.add(good);
        System.out.println(list);
    }
}
